<?php
/**
 * Created by PhpStorm.
 * User: Yangjinlei
 * Date: 2018/6/27
 * Time: 9:14
 */

namespace App\Repositories;


use App\Contracts\AuthInterface;
use App\Exceptions\DataNotFindException;
use Bosnadev\Repositories\Eloquent\Repository;

class UserRepository extends BaseRepository implements AuthInterface
{

    /**
     * Specify Model class name
     *
     * @return mixed
     */
    public function model()
    {
        return 'App\Models\User';
    }

    /**
     * @param String $name
     * @param String $password
     * @return mixed
     * @throws DataNotFindException
     */
    public function checkUser(String $name, String $password)
    {
        $user = $this->findAllBy('name',$name);
        if (empty($user))
            throw new DataNotFindException();

        return $user;
    }
}